<template>
  <div id="bpmn-app">
    <bpmn-toolbar class="bpmn-app__toolbar" v-if="getEditorConfig.toolbar" />
    <div class="bpmn-app__content">
      <bpmn-designer class="bpmn-app__content-designer" :xml.sync="xmlString" />
      <bpmn-panel class="bpmn-app__content-panel"></bpmn-panel>
    </div>
  </div>
</template>

<script>
import BpmnToolbar from "@bpmn/components/toolbar";
import BpmnPanel from "@bpmn/components/panel";
import BpmnDesigner from "@bpmn/components/designer";
import { mapGetters } from "vuex";

export default {
  name: "BpmnCom",
  components: {
    BpmnToolbar,
    BpmnPanel,
    BpmnDesigner,
  },
  computed: {
    ...mapGetters(["getEditorConfig"]),
  },
  data() {
    return {
      xmlString: undefined,
    };
  },
  mounted() {
    document.body.addEventListener("contextmenu", function (ev) {
      ev.preventDefault();
    });
    this.setInitXml()
  },
  methods: {
    setInitXml() {
      const workInfo = this.$route.params.workInfo
      this.xmlString = workInfo.bpmnXml
    }
  }
};
</script>

<style lang="scss" scoped>
.bpmn-app {
  &__toolbar {
  }
  &__content {
    display: flex;
    height: 100%;
    &-designer {
    }
    &-panel {
      // padding-right: 10px;
    }
  }
}
</style>
